package com.why.model;

import java.util.ArrayList;
import java.util.List;

public class RequestModel {

    private String msgName;
    private String msgDesc;
    private List<ParamModel> paramModelList = new ArrayList<>();

    public static class ParamModel {
        private String paramName;

        private String paramDesc;

        private String paramType;

        private String msgParamType;

        private String defaultValue;

        private String paramCharType;

        public String getParamName() {
            return paramName;
        }

        public void setParamName(String paramName) {
            this.paramName = paramName;
        }

        public String getParamDesc() {
            return paramDesc;
        }

        public void setParamDesc(String paramDesc) {
            this.paramDesc = paramDesc;
        }

        public String getParamType() {
            if (paramType.contains(">")) {
                return paramType.split(">")[1];
            }
            return paramType;
        }

        public void setParamType(String paramType) {
            this.paramType = paramType;
        }

        public String getDefaultValue() {
            return defaultValue;
        }

        public void setDefaultValue(String defaultValue) {
            this.defaultValue = defaultValue;
        }

        public String getMsgParamType() {
            return msgParamType;
        }

        public void setMsgParamType(String msgParamType) {
            this.msgParamType = msgParamType;
        }

        public String getParamCharType() {
            return paramCharType;
        }

        public void setParamCharType(String paramCharType) {
            this.paramCharType = paramCharType;
        }

        public String getBaseType() {
            if (paramType.split(">")[0].equalsIgnoreCase("enum")) {
                return "enum";
            } else if (paramType.split(">")[0].equalsIgnoreCase("innerclass")) {
                return "innerclass";
            } else {
                return "base";
            }
        }

        @Override
        public String toString() {
            return "ParamModel{" +
                    "paramName='" + paramName + '\'' +
                    ", paramDesc='" + paramDesc + '\'' +
                    ", paramType='" + paramType + '\'' +
                    ", defaultValue='" + defaultValue + '\'' +
                    '}';
        }
    }

    public String getMsgName() {
        return msgName;
    }

    public void setMsgName(String msgName) {
        this.msgName = msgName;
    }

    public String getMsgDesc() {
        return msgDesc;
    }

    public void setMsgDesc(String msgDesc) {
        this.msgDesc = msgDesc;
    }

    public List<ParamModel> getParamModelList() {
        return paramModelList;
    }

    public void setParamModelList(List<ParamModel> paramModelList) {
        this.paramModelList = paramModelList;
    }

    @Override
    public String toString() {
        return "RequestModel{" +
                "msgName='" + msgName + '\'' +
                ", msgDesc='" + msgDesc + '\'' +
                ", paramModelList=" + paramModelList +
                '}';
    }
}
